home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / src / editors / DME / rexx / DICEHelp.DME next >
Text File  |  1994-02-01  |  2KB  |  72 lines

  1. /*
  2. **    DICEHelp help system.  Script for DME Editor.
  3. **
  4. **    Sample key definition, place in your DME s:.EDRC file:
  5. **
  6. **        map a-help    (scanf %s rx1 DiceHelp1 \$scanf)
  7. **
  8. */
  9. OPTIONS FAILAT 5
  10. rc = 0
  11. OPTIONS RESULTS
  12.  
  13. parse arg searchstr junk
  14.  
  15. title '(' "Searching for" searchstr ')'
  16.  
  17. hostname = address()        /* Source DME window */
  18. portname = 'DICEHELP'           /* DICEHelp's port name */
  19. tempname = 't:DICEHelp.temp'    /* Temporary file for passing clips */
  20.  
  21. /* If resident process is not loaded, try to load it.  Wait 6 seconds. */
  22. if ~show('p',portname) then do
  23.     address COMMAND 'RUN >NIL: <NIL: DICEHelp REXXSTARTUP'
  24.  
  25.     do i = 1 to 6
  26.         if ~show('p',portname) then do
  27.             address COMMAND 'wait 1'
  28.         end
  29.     end
  30.  
  31.     if ~show('p',portname) then do
  32.         title '(DICEHelp program not found!)'
  33.         exit
  34.     end
  35. end
  36.  
  37. /* Ask DICEHelp for insight.  Display results, or error message */
  38. address value portname
  39. T searchstr            /* Search for string, return <T>empfile */
  40. if RC=0 then do
  41.     refline = RESULT
  42.     refstring = SUBWORD( refline, 2 )
  43.  
  44.     address value hostname         /* Back to DME */
  45.  
  46.     if LENGTH(refstring) <= 0 then do  /* If a NULL line, bail */
  47.         title '(' "Item" searchstr "not found!" ')'
  48.         exit
  49.     end
  50.  
  51.     title '(' loading refstring ')'
  52.     /*address command "Wait 1"*/
  53.     openwindow '+0+0+600+100' newfile refstring
  54.  
  55.     newport = RESULT            /* get the port         */
  56.     if RC > 0 then do            /* if not there, then error */
  57.          title '(Error: error opening doc file.)'
  58.         address command "Wait 6"
  59.         exit
  60.     end
  61.  
  62.     exit
  63. end
  64. else if RC=1 then do
  65.     address value hostname
  66.     title '(' "Item" searchstr "not found!" ')'
  67. end
  68. else do
  69.     address value hostname
  70.     title '(' "Error code" RC "DICEHelp failed!" ')'
  71. end
  72.